package practice2;

import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

public class P8651 {

    private static Set<String> set = new TreeSet<>();

    public static void isOk(String y,String m,String d){
        int year = Integer.parseInt(y);
        int month = Integer.parseInt(m);
        int day = Integer.parseInt(d);
        if(year>=0&&year<=59){
            year+=2000;
        }else {
            year+=1900;
        }
        if((year%4==0 && year%100!=0) || year%400==0){
            //说明是闰年
            if(month==2 && (day>=1&&day<=29)){
                String time;
                if(day>=10){
                    time = year+"0"+month+""+day;
                }else {
                    time = year+"0"+month+"0"+day;
                }
                set.add(time);
            }else if((month==1||month==3||month==5||month==7||month==8||month==10||month==12) && (day>=1&&day<=31)){
                String time;
                if(month>=10 && day>=10){
                    time =year+""+month+""+day;
                }else if(month>=10 && day<10){
                    time =year+""+month+"0"+day;
                }else if(month<10 && day>=10){
                    time =year+"0"+month+""+day;
                }else {
                    time =year+"0"+month+"0"+day;
                }
                set.add(time);
            }else if((month==4||month==6||month==9||month==11) && (day>=1&&day<=30)){
                String time;
                if(month>=10 && day>=10){
                    time =year+""+month+""+day;
                }else if(month>=10 && day<10){
                    time =year+""+month+"0"+day;
                }else if(month<10 && day>=10){
                    time =year+"0"+month+""+day;
                }else {
                    time =year+"0"+month+"0"+day;
                }
                set.add(time);
            }
        }else {
            //说明是平年
            if(month==2 && (day>=1&&day<=29)){
                String time;
                if(day>=10){
                    time = year+"0"+month+""+day;
                }else {
                    time = year+"0"+month+"0"+day;
                }
                set.add(time);
            }else if((month==1||month==3||month==5||month==7||month==8||month==10||month==12) && (day>=1&&day<=31)){
                String time;
                if(month>=10 && day>=10){
                    time =year+""+month+""+day;
                }else if(month>=10 && day<10){
                    time =year+""+month+"0"+day;
                }else if(month<10 && day>=10){
                    time =year+"0"+month+""+day;
                }else {
                    time =year+"0"+month+"0"+day;
                }
                set.add(time);
            }else if((month==4||month==6||month==9||month==11) && (day>=1&&day<=30)){
                String time;
                if(month>=10 && day>=10){
                    time =year+""+month+""+day;
                }else if(month>=10 && day<10){
                    time =year+""+month+"0"+day;
                }else if(month<10 && day>=10){
                    time =year+"0"+month+""+day;
                }else {
                    time =year+"0"+month+"0"+day;
                }
                set.add(time);
            }
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String date = sc.nextLine();
        String[] strings = date.split("/");
        isOk(strings[0],strings[1],strings[2]);
        isOk(strings[2],strings[0],strings[1]);
        isOk(strings[2],strings[1],strings[0]);
        for(String time:set){
            String year = time.substring(0,4);
            String month = time.substring(4,6);
            String day = time.substring(6,8);
            System.out.println(year+"-"+month+"-"+day);
        }
    }
}
